﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebEntities.Models.ProductInfo
{
    public class RecomProduct
    {
        public int RecomID { get; set; }
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public string IndexCover { get; set; }
        public int? SortNum { get; set; }
        public string IndexArea { get; set; }

        public static RecomProduct AsRecomProduct(PP_RecommendProduct wirprod)
        {
            RecomProduct rprod = new RecomProduct
            {
                RecomID = wirprod.RecomID,
                ProductID = wirprod.ProductID,
                ProductName = (wirprod.PP_Product != null) ? wirprod.PP_Product.ProductName : string.Empty,
                IndexCover = wirprod.IndexCover,
                SortNum = wirprod.SortNum,
                IndexArea = wirprod.IndexArea
            };
            return rprod;
        }
    }
}
